package next.fire.mq.client;

import next.fire.mq.api.MessageListener;
import next.fire.mq.api.model.Message;
import next.fire.mq.api.model.TextMessage;

import java.util.Date;

public class MessageListenerLogImpl implements MessageListener {

    @Override
    public void onMessage(Message msg) {
        if (msg instanceof TextMessage) {
            TextMessage textMsg = (TextMessage) msg;
            System.out.println(new Date() + " ---> " + (System.currentTimeMillis() - msg.getSendTime().getTime()));
            // System.out.println("---> " + textMsg.getText());
        }
    }
}
